package design_pattern.momento.Test2;

/**
 * Created by WeiDingKuo on 2017/10/27 14:49
 */
public class Orignator {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public MomentoIF createMomento() {
        return new Momento(this.name);
    }

    public void restoreMomento(MomentoIF momentoIF) {
        this.name = ((Momento) momentoIF).getName();
    }

    private class Momento implements MomentoIF {
        private String name;

        public Momento(String name) {
            this.name = name;
        }

        public String getName() {
            return name;
        }
    }
}
